<template>
  <div id="app">
      <div class="loginCard">

      <!-- 新增头部区域 -->
      <header class="card-header">
          <img src="@/assets/wuye.png" alt="Logo" class="logo" />
          <h1 class="header-title">智慧物业</h1>
        </header>
     
      <el-form ref="employee" :model="employee" label-width="80px" class="loginForm">

          <el-form-item label="手机号" prop="phone">
              <el-input v-model="employee.phone"></el-input>
          </el-form-item>

          <el-form-item label="密码" prop="password">
              <el-input v-model="employee.password"></el-input>
          </el-form-item>

          
    
          <el-form-item>
              <el-button type="primary" @click="regerted">立即注册</el-button>
              <el-button type="primary" @click="login">登录</el-button>
          </el-form-item>
      </el-form>
  </div>
  </div>
</template>
<script>

  export default {
      data() {

          return {

              employee: {},

          }
      },
      mounted() {
  
      },

      methods: {



          login() {
             
              this.$axios.get("/users/login", { params: {phone:this.employee.phone,
                  password:this.employee.password,
          
              } })
                  .then(resp => {
                      if (resp.data.code == 200) {

                          this.$message({
                              message: '登录成功',
                              type: 'success'
                          });
                          //跳转
                          this.$router.push('/main')
                      } else {
                          this.$message.error("登录失败")
                    
                      }
                  })
          },

          regerted() {
         
                  this.$router.push('/Regerted')

          }

      }
  }
</script>
<style>

</style>